﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<skags.Models.NewsTablesViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Fréttir
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div id="navigation">
<% Html.RenderPartial("NewsNavigation"); %>
<% Html.RenderPartial("NewsCategories"); %>
</div>
<div id="content">
<%
    if (Model.News.Count() == 0)
    {
        Response.Write("Engar fréttir til.");
    }
    else
    {
        foreach (var newsitem in Model.News)
        {
       %>
            <div class="news_item">
                <h2><%= Html.ActionLink(newsitem.Title, "ViewItem", new { newsitem.ID })%></h2>
                <h3 class="news_date"><%= newsitem.DateCreated%></h3>
                <h3 class="news_readCount">Fjöldi lesninga: <%= newsitem.ReadCount.ToString() == "" ? 0 : newsitem.ReadCount %></h3>
                <p class="news_text"><%= newsitem.Text%></p>
            </div>
       <%
        }
    }
     %>
</div>
</asp:Content>
